package com.huitone.smspfm.socket.model;

import java.net.InetAddress;

import com.bin.common.utils.StringUtils;

/**   
* @Title LoginInfo.java 
* @Package com.huitone.smspfm.socket 
* @Description TODO(用一句话描述该文件做什么) 
* @author ybliang   
* @date 2017年7月16日 下午8:02:27 
* @version V1.0   
*/
public class AccountInfo {

	private String random = StringUtils.uuid();
	private String srvNode = null;
	private String loginName = null;
	private String loginPassword = null;
	private Integer maxFlux = 100;
	private Integer maxConn = 5;
	private boolean isLogin = false;
	private InetAddress inetAddress = null;
	
	public boolean isControlFlux() {
		return (maxFlux == null || maxFlux == 0) ? false : true;
	}
	
	public String getRandom() {
		return random;
	}
	public void setRandom(String random) {
		this.random = random;
	}
	public String getSrvNode() {
		if (StringUtils.isEmpty(srvNode)) {
			return random;
		}
		return srvNode;
	}
	public void setSrvNode(String srvNode) {
		this.srvNode = srvNode;
	}
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getLoginPassword() {
		return loginPassword;
	}
	public void setLoginPassword(String loginPassword) {
		this.loginPassword = loginPassword;
	}
	public InetAddress getInetAddress() {
		return inetAddress;
	}
	public void setInetAddress(InetAddress inetAddress) {
		this.inetAddress = inetAddress;
	}
	public boolean isLogin() {
		return isLogin;
	}
	public void setLogin(boolean isLogin) {
		this.isLogin = isLogin;
	}

	public Integer getMaxFlux() {
		return maxFlux;
	}

	public void setMaxFlux(Integer maxFlux) {
		this.maxFlux = maxFlux;
	}

	@Override
	public String toString() {
		return "AccountInfo [random=" + random + ", srvNode=" + srvNode + ", loginName=" + loginName + ", maxFlux="
				+ maxFlux + ", maxConn=" + maxConn + ", IP=" + (inetAddress != null ? inetAddress.getHostAddress() :"") + "]";
	}
	
	public Integer getMaxConn() {
		return maxConn;
	}

	public void setMaxConn(Integer maxConn) {
		this.maxConn = maxConn;
	}
}
